//
//  CLBaseNavController.swift
//  WeiBo
//
//  Created by 程雷 on 2017/1/4.
//  Copyright © 2017年 chenglei. All rights reserved.
//

import UIKit

class CLBaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        
        let count = self.childViewControllers.count
        
        if count > 0 {
            
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", action: #selector(clickBackButton), target: self)
            
            viewController.hidesBottomBarWhenPushed = true
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
   @objc private func clickBackButton(){
    
        self.popViewController(animated: true)
    }

}
